//
//  HeadView.m
//  树形tableview
//
//  Created by 尤维维 on 2017/10/30.
//  Copyright © 2017年 EmicNet. All rights reserved.
//

#import "HeadView.h"

@interface HeadView()

@property(nonatomic, strong) UILabel *lable;

@end

@implementation HeadView

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.lable = [[UILabel alloc] initWithFrame:CGRectMake(frame.origin.x + 10, 0, 100, frame.size.height)];
        [self addSubview:self.lable];
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapClick:)];
        [self addGestureRecognizer:tap];
    }
    return self;
}

- (void)setTitle:(NSString *)title {
    self.lable.text = title;
}

- (void)setLevel:(int)level {
    _level = level;
    self.lable.frame = CGRectMake(level * 10 + 10, 0, 100, self.frame.size.height);
}

- (void)tapClick:(UITapGestureRecognizer *)tap {
    self.tapClickBlock();
}

@end
